#ifndef IPROJECTCOMPILERPLUGIN_H
#define IPROJECTCOMPILERPLUGIN_H

#include <string>

#include "../iprojectplugin.h"

class ProjectEventBus;
class ProjectPrivate;
class IProjectCompilerPlugin : public IProjectPlugin
{
    public:
        IProjectCompilerPlugin() {}
        virtual ~IProjectCompilerPlugin() {}
        virtual void Initialize() = 0;

        /// events
        virtual void RegisterEvent( ProjectEventBus* eventBus ) = 0;
        virtual bool HandleEvent( Events::Event* event ) = 0;
        virtual void Release() {}

        /// build management
        virtual bool prune() { return true; }
        virtual bool build() = 0;
        virtual bool clean() = 0;
        virtual bool install() { return true; }
        virtual bool rebuild() { return clean() && build(); }

    protected:
        /// NOTE: a fake singleton member, initialize it whenever catch the event signal data
        ProjectPrivate* d;
};

#define DECLARE_PROJECT_COMPILER_PLUGIN_CLASS(ClassName) \
DECLARE_PROJECT_PLUGIN_CLASS(ClassName)

#define INIT_PROJECT_COMPILER_PLUGIN_FACTORY(ClassName) \
INIT_PROJECT_PLUGIN_FACTORY(ClassName)

#define INIT_PROJECT_COMPILER_PLUGIN_NAME(NameStr) \
INIT_PROJECT_PLUGIN_NAME(NameStr)

#define INIT_PROJECT_COMPILER_PLUGIN_VERSION(VersionNum) \
INIT_PROJECT_PLUGIN_VERSION(VersionNum)

#define INIT_PROJECT_COMPILER_PLUGIN_AUTHOR(AuthorStr) \
INIT_PROJECT_PLUGIN_AUTHOR(AuthorStr)

#endif // IPROJECTCOMPILERPLUGIN_H
